package com.zhanjixun.biz.dao;

import com.zhanjixun.api.domain.UserDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author :zhanjixun
 * @date : 2018/12/24 17:43
 */
public interface UserDAO {

    @Select("SELECT * FROM user WHERE id = #{id}")
    UserDTO selectById(@Param("id") int id);

    @Insert("INSERT INTO USER (NAME,USER_NAME,PASSWORD) VALUES (#{u.name},#{u.userName},#{u.password});")
    int insertUser(@Param("u") UserDTO userDTO);

    @Select("SELECT * FROM USER WHERE USER_NAME = #{userName} AND PASSWORD = #{password}")
    UserDTO selectByUserNameAndPassword(@Param("userName") String userName, @Param("password") String password);

}
